﻿@using BonjourQuotation.UI.Models.AccountModel
@model CreateUserViewModel


@{
    ViewBag.Title = "Create User";
    Layout = "~/Views/Shared/_Layout.cshtml";
    @Scripts.Render("~/Scripts/UIScript/Manage/Account.js")
}

<div id="UserDetailsDiv" style="display:none;"></div>
<div class="container">
    <div class="FormsDiv">
        @using (@Html.BeginForm("CreateUser", "Account", FormMethod.Post, new { @class = "form-horizontal", id = "CreateUserForm" }))
        {

            <h1>Create User</h1>
            <div id="CreateUserFormDiv">
                <div class="Lines760"></div>
                <div id="ErrorMessagesDiv" style="margin: auto;width: 760px;height: 30px;">
                    <label for="Validation" id="errorMessageClient" class="errorMessage"></label>
                    <div id="errorMessageServer">
                        @if (Model.Message != null)
                        {
                            @Html.LabelForModel(Model.Message, new { @class = "errorMessage" })
                            if (Model.IsCreated)
                            {
                                <button class="btn14 btn120" type="button" onclick="ShowUserDetails('@Model.EmployeeID')">Add Details</button>
                            }
                        }
                    </div>
                </div>
                <div class="ElementsPaddingRight30">
                    <div class="UserNameDiv">
                        @Html.TextBoxFor(model => Model.UserName, new { id = "username", @class = "username ElementsForValidation Required", placeholder = "Username" })
                    </div>
                </div>
                <div class="ElementsPaddingRight30">
                    <div class="PasswordDiv">
                        @Html.PasswordFor(model => Model.Password, new { id = "password", @class = "password ElementsForValidation MinLength4 Required", placeholder = "Password" })
                    </div>
                </div>
                <div class="ElementsPaddingRight30">
                    <div class="PasswordDiv">
                        @Html.PasswordFor(model => Model.RePassword, new { id = "repassword", @class = "password ElementsForValidation Required", placeholder = "Repeat Password" })
                    </div>
                </div>
                <div class="SelecteRoleDiv">
                    @Html.LabelFor(model => Model.Role, new { @class = "RoleLabel" })
                    <div class="RoleDrop">
                        @Html.DropDownListFor(x => x.SelectedRole, new SelectList(Model.Role, "Value", "Text"), new { @class = "SelecteRole" })
                    </div>
                </div>
                <div class="Lines760" id="passwordLines"></div>
                <div id="CreateUserBtnDiv">
                    @if(Model.MenuManageCreateUserEdit)
                    { 
                        <button type="submit" class="btn14" id="CreateUserBtn">Create</button>
                    }
                    else
                    {
                        <button type="submit" class="btn14" id="CreateUserBtn" disabled="disabled">Create</button>
                    }
                </div>
            </div>
        }
    </div>
</div>


